import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:intl/intl.dart';
import 'package:mall/constant/string.dart';
import 'package:mall/entity/integral_exchange_entity.dart';

class TileCard extends StatelessWidget {
  final ListData recovery;
  final String img;
  final String title;
  final String author;
  final String authorUrl;
  final String type;
  final double worksAspectRatio;

  TileCard(
      {this.img,
      this.title,
      this.author,
      this.authorUrl,
      this.type,
      this.worksAspectRatio,
      this.recovery});
  String _formatTime(ListData recovery) {
    DateTime now = DateTime.parse(recovery.fcreatetime);
    return DateFormat('yyyy-MM-dd').format(now);
  }
  _goRecoveryDetail(int recoveryId) {}
  @override
  Widget build(BuildContext context) {
    return Card(
        child: InkWell(
            onTap: () => _goRecoveryDetail(recovery.fid),
            child: Container(
              margin: EdgeInsets.all(ScreenUtil().setWidth(10.0)),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Container(
                    height: ScreenUtil().setHeight(60.0),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: <Widget>[
                        Expanded(
                            child: Container(
                                alignment: Alignment.centerLeft,
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.start,
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: <Widget>[
                                    Text(Strings.MINE_RECOVERY_NAME +
                                        "${recovery.fname}"),
                                  ],
                                ))),
                        Padding(
                            padding: EdgeInsets.only(
                                left: ScreenUtil().setWidth(5.0))),
                        Expanded(
                            child: Container(
                                alignment: Alignment.centerRight,
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.start,
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: <Widget>[
                                    Text(Strings.MINE_RECOVERY_TIME +
                                        _formatTime(recovery)),
                                  ],
                                )))
                      ],
                    ),
                  ),
                  Container(
                    height: ScreenUtil().setHeight(60.0),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: <Widget>[
                        Expanded(
                            child: Container(
                                alignment: Alignment.centerLeft,
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.start,
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: <Widget>[
                                    Text(Strings.MINE_RECOVERY_FTOTAL_INTEGRAL +
                                        "${recovery.ftotalIntegral ?? "0"}"),
                                  ],
                                ))),
                        Padding(
                            padding: EdgeInsets.only(
                                left: ScreenUtil().setWidth(5.0))),
                        Expanded(
                            child: Container(
                                alignment: Alignment.centerRight,
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.start,
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: <Widget>[
                                    Text(Strings.MINE_RECOVERY_WIGHT +
                                        "${recovery.fnum}${recovery.funitname}"),
                                  ],
                                )))
                      ],
                    ),
                  ),
                ],
              ),
            )));
  }
}
